import React, { Component } from 'react'
export default class App extends Component {
    render() {
        return (
            <div>
                {/* 方法一,适合写少量逻辑代码 */}
                <button onClick={()=>{console.log('btn1')}}>but1</button>
                {/* 方法二, */}
                <button onClick={this.foo1}>btn2</button>
            </div> 
        )
    }
    foo1(){
        console.log('btn2')
    }
}